package com.ysl.study.designpattern.createmode.singleton;

/**
 * 单例模式 懒汉模式 双重校验锁
 *
 * @author yangshanlin
 * @date 2023/2/16 18:12
 * @describe
 */
public class Singleton4 {
    private Singleton4(){}

    private static Singleton4 single = null;

    public static Singleton4 getInstance(){
        if(single == null){
            synchronized (Singleton4.class){
                if (single == null){
                    single = new Singleton4();
                }
            }
        }
        return single;
    }

}
